<?php
declare(strict_types=1);

namespace App\Common\Modular\System\Traits\Configure\Traits;

use App\Common\Modular\Data\Enums\ResourcesCateState;
use Core\Package\ElementPlus\FormCreate\FormItem;

trait UploaderForm
{
    public function getUploaderFormRule($configure): array
    {
        $rules = [];
        foreach (ResourcesCateState::Datas(ResourcesCateState::TAG['TYPE']) as $item) {
            $rules[] = FormItem::Labels($item['value'], "{$item['label']}上传", $configure[$item['value']] ?? [])->hint("允许上传的{$item['label']}格式,如:jpg,不设置代表不限制")->limit(200);
        }
        return $rules;
    }
}